﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace _002_课程学习
{
    class Program
    {
        static void Main(string[] args)
        {
            /*Console.WriteLine("请输入一个秒数:");
            int miao = Convert.ToInt32(Console.ReadLine());
            int fen,shi, tian,temp;//定义变量
            tian = shi = fen = temp = 0;//初始化变量
            tian = miao / (60 * 60 * 24);//计算天数
            temp = miao % (60 * 60 * 24);//获取不能计算天数的秒数；
            shi = temp / (60 * 60);//计算小时数
            temp = temp % (60 * 60);//获取不能计算小时数的秒数；
            fen = temp / 60;//计算分钟数
            miao = temp % 60;//获取剩余的秒数
            Console.WriteLine(tian+"天"+shi+"小时"+fen+"分钟"+miao+"秒");*/

            //可空类型
            /*int? a = null;
            int? b = 2;
            int? c = 1;
            int? d;
            d = a ?? c ?? b;
            Console.WriteLine(d);
            Console.ReadKey();*/

            /*int num =new Random().Next(0,101);
            Console.WriteLine("猜数字");
            Console.WriteLine("请输入100以内的数字(只有十次机会)：");
            int count = 10;

            while (true)
            {
                int temp = Convert.ToInt32(Console.ReadLine());
                if (temp > num)
                {
                    Console.WriteLine("大了");
                }
                else if(temp <num)
                {
                    Console.WriteLine("小了");
                }
                else
                {
                    Console.WriteLine("冰果，答对了");
                    break;
                }
                count--;
                
                if (count == 0)
                {
                    Console.WriteLine("你没有机会了");
                    break;
                }
                else
                {
                    Console.WriteLine("你还剩" + count + "次机会");
                }
            }*/

            /*//装箱
            int a = 10;
            object s = a;
            Console.WriteLine(s);*/


            //拆箱

            /*string num = Console.ReadLine();
            string re = "";
            for(int i = num.Length - 1; i >= 0; i--)
            {
                re += num[i];
            }
            Console.WriteLine(re);*/

            //string num = Console.ReadLine();//获取数字字符串

            //int sum = int.Parse(num);//字符串转整数类型

            //int num1 = num.Length;//获取这段数字有几位

            //while (num1>0)//循环获取每个数字

            //{

            //    int a = sum % 10;//求最后一位数的数字

            //    sum = sum / 10;//删除最后一位数

            //    num1--;//循环次数减一

            //    Console.Write(a);//从尾到头输出

            //}


            //这里为获取用户输入的参数
            Console.WriteLine("请输入年月日,并且以-为分隔");
            string time = Console.ReadLine();//获取输入的参数

            //这里为判断年份是不是闰年
            string[] arr = time.Split('-');//分割参数为年月日；
            int year = int.Parse(arr[0]);//获取年号
            string nian = "普通年";//定义普通年
            if (year % 4 == 0|| year%100==0 && year%400 == 0)//判断闰年或者世纪闰年符不符合条件；
            {
                nian = "闰年";
            }

            //这里为实现月份里有几天
            int mouth = int.Parse(arr[1]);//获取月份
            string tian = "";
            switch (mouth)//判断月份的天数
            {
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12:
                    tian = "是31天的月份";
                    break;
                case 4:
                case 6:
                case 9:
                case 11:
                    tian = "是30天的月份";
                    break;
                case 2:
                    if (year % 4 == 0 || year%100 == 0 &&year % 400 == 0)//判断闰年或者世纪闰年符不符合条件；
                    {
                        tian = "是29天的月份";
                    }
                    else
                    {
                        tian = "是28天的月份";
                    }
                    break;
            }

            //这里为实现判断日期为星期几
            DateTime date = Convert.ToDateTime(time);//转换为时间类型
            string dayOfWeek = "";
            switch (date.DayOfWeek)//把日期转换为星期几，并且转换为中文
            {

                case DayOfWeek.Sunday:

                    dayOfWeek = "星期天";

                    break;

                case DayOfWeek.Monday:

                    dayOfWeek = "星期一";

                    break;

                case DayOfWeek.Tuesday:

                    dayOfWeek = "星期二";

                    break;

                case DayOfWeek.Wednesday:

                    dayOfWeek = "星期三";

                    break;

                case DayOfWeek.Thursday:

                    dayOfWeek = "星期四";

                    break;

                case DayOfWeek.Friday:

                    dayOfWeek = "星期五";

                    break;

                case DayOfWeek.Saturday:

                    dayOfWeek = "星期六";

                    break;
            }

            //这里为最终输出结果
            Console.WriteLine(time+":"+mouth+"月"+tian+" " +nian+" "+dayOfWeek);
            Console.ReadKey();
        }
    }
}
